package hibernate;

import org.hibernate.cfg.ImprovedNamingStrategy;

@SuppressWarnings("serial")
public class LocalNamingStrategy extends ImprovedNamingStrategy {

	private String tablePrefix = "";

	public String classToTableName(String className) {
		return tablePrefix + super.classToTableName(className);
	}

	public String foreignKeyColumnName(String propertyName,
			String propertyEntityName, String propertyTableName,
			String referencedColumnName) {
		return super.foreignKeyColumnName(propertyName, propertyEntityName,
				propertyTableName, referencedColumnName)
				+ "_id";
	}
	

	public String getTablePrefix() {
		return tablePrefix;
	}

	public void setTablePrefix(String tablePrefix) {
		this.tablePrefix = tablePrefix;
	}
}
